aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/fund/[id]/access/+page.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/fund/[id]/access/+page.svelte')
-rw-r--r--src/routes/(app)/fund/[id]/access/+page.svelte38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/routes/(app)/fund/[id]/access/+page.svelte b/src/routes/(app)/fund/[id]/access/+page.svelte
index 754ddf87..f18d6357 100644
--- a/src/routes/(app)/fund/[id]/access/+page.svelte
+++ b/src/routes/(app)/fund/[id]/access/+page.svelte
@@ -1,8 +1,19 @@
<script>
+ import { fail, post } from "$lib/utils";
+ import { enhance } from "$app/forms";
+ import { t } from "$lib/translations";
import Avatar from "$comp/Avatar.svelte";
let { data } = $props();
- let { managers } = $derived(data);
+ let { id, managers } = $derived(data);
+ let username = $state();
+ let del = async ({ id }) => {
+ try {
+ await post("/post/fund/access/delete", { id });
+ } catch (e) {
+ fail(e.message);
+ }
+ };
</script>
<div class="container px-4 max-w-4xl mx-auto mt-10 space-y-5">
@@ -15,15 +26,36 @@
</h1>
{#each managers as c}
- <a href={`/pay/${c.username}`} class="contents">
- <div class="flex hover:bg-base-200 p-2">
+ <a href={`/${c.username}`} class="contents">
+ <div class="flex hover:bg-base-200 p-2 items-center">
<Avatar user={c} size={20} disabled={true} />
<div class="my-auto text-left">
<p class="ml-1 text-lg break-words">{c.username}</p>
</div>
+ <button onclick={() => del(c)} class="ml-auto">
+ <iconify-icon icon="ph:trash-bold" width="32"></iconify-icon>
+ </button>
</div>
</a>
{/each}
+
+ <form method="post" use:enhance class="space-y-2">
+ <input type="hidden" name="id" value={id} />
+ <input
+ name="username"
+ bind:value={username}
+ placeholder={$t("funds.username")}
+ />
+ <button type="submit" class="btn">
+ <iconify-icon icon="ph:plus-bold" width="32"></iconify-icon>
+ {$t("funds.addManager")}
+ </button>
+ </form>
+
+ <a href={`/fund/${id}`} class="btn">
+ <iconify-icon icon="ph:arrow-left-bold" width={32}></iconify-icon>
+ {$t("funds.returnToFund")}</a
+ >
</div>
</div>
</div>